Add and Revise Receiver Interface Comments#1710
Conversation
Coverage Report for CI Build 29432697163Coverage remained the same at 86.187%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
968f5e6 to
2183b5d
Compare
2183b5d to
438d440
Compare
| /// the increased transaction size. If a sender specifies a receiver output for this purpose, this | ||
| /// function sets that parameter to None so that it is ignored in subsequent steps of the | ||
| /// receiver flow. This protects the receiver from accidentally subtracting fees from their own | ||
| /// outputs. |
There was a problem hiding this comment.
This paragraph about additional_fee_contribution being cleared when it points at a receiver-owned output got dropped in the rewrite. That protection is still implemented, just moved to OriginalContext::new in common/mod.rs:35-40
Worth keeping this detail, it's not obvious from the new "ensure at least one output pays the receiver" wording, and it's a real guarantee callers should know about.
There was a problem hiding this comment.
Updated. What do you think?
| /// Validates whether the original PSBT contains outputs which pay to the receiver and only | ||
| /// then proceeds to the next typestate. | ||
| /// Identify which outputs in the original transaction belong to the receiver | ||
| /// and ensure at least one output pays the receiver. | ||
| /// | ||
| /// Additionally, this function also protects the receiver from accidentally subtracting fees | ||
| /// from their own outputs: when a sender is sending a proposal, | ||
| /// they can select an output which they want the receiver to subtract fees from to account for | ||
| /// the increased transaction size. If a sender specifies a receiver output for this purpose, this | ||
| /// function sets that parameter to None so that it is ignored in subsequent steps of the | ||
| /// receiver flow. This protects the receiver from accidentally subtracting fees from their own | ||
| /// outputs. |
There was a problem hiding this comment.
Same as the note on v1/mod.rs, this paragraph about additional_fee_contribution sanitization was dropped here too
There was a problem hiding this comment.
Also updated.
Rework the doc comments in the v2 receive module so the state-level comments are concise and point to the method that advances to the next typestate, while the per-method comments align with the wording added to the FFI interface. Method docs now name their explicit transition return type and describe the state each transition yields once successfully persisted.
Apply the same doc comment rework to the v1 receive module: state-level comments are concise and point to the method that advances to the next typestate, while per-method comments align with the wording used in the FFI interface. Unlike v2, v1 methods return the next state directly, so the docs describe the returned state without transition or persistence framing.
438d440 to
0cb183a
Compare
Summary
This PR builds off of #1653 which added clear and consistent comments to the FFI receiver interface where they were missing before. This PR expands that work to revise the v1 and v2 comments to align closely with the patterns established in the FFI interface and add consistency to the doc strings between all the different typestates and interfaces. The goal of this PR was to make the documentation on how to use these receiver interfaces more clear and concise, and if deemed a strict improvement might be good to include in PDK v1.0 release.
Claude Opus 4.8 was used to collaboratively create and revise these doc strings.
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.